// 菜单数据格式示例（后端返回）
// [
//   { name: 'Dashboard', path: '/dashboard', component: 'dashboard', children: [] },
//   { name: '用户管理', path: '/system/user', component: 'system/user', children: [] }
// ]
const views = {
  Admin: () => import('@/views/Admin.vue'),
}
export function generateRoutes (menuList) {
    return menuList.map(menu => {
        const route = {
            path: menu.path,
            name: menu.name,
            component: () => {
                return views[menu.component]()
            }
        }
        if (menu.children && menu.children.length) {
            route.children = generateRoutes(menu.children)
        }
        return route
    })
}